﻿@model DoAnWebsite.Models.Ask
@using Ext.Net
@using Ext.Net.MVC
@{
    ViewBag.Title = "Edit Question";
    Layout = "~/Views/Shared/_Layout_Admin.cshtml";
}

@section Header
{
}
@section ToolbarSection{
    @Html.X().Button().Text("Save").ID("btnSave").Disabled(true).Icon(Icon.Disk).DirectEvents(de =>
            {
                de.Click.Url = Url.Action("EditQuestion");
                de.Click.EventMask.ShowMask = true;
                de.Click.FormID = "FormPanelEditQuestion";
            })
    
    @Html.X().Button().Text("Back").Icon(Icon.ArrowLeft).Margins("0 0 0 10").Listeners(ls => ls.Click.Handler = "window.parent.location.reload();parentAutoLoadControl.close();")
}

@Html.X().FormPanel().ID("FormPanelEditQuestion").Title("Edit Question").StyleSpec("position: static; z-index: 10;width: 100%;").AutoScroll(true).Listeners(
ls => ls.ValidityChange.Handler = "App.btnSave.setDisabled(!valid)").Items(
        Html.X().HiddenFor(m=>m.AskId),
        Html.X().ComboBoxFor(m => m.GroupNewsId).FieldLabel("Group").SelectedItems(Model.GroupNewsId.ToString()).LabelWidth(130).Items(ViewBag.GQuestionId).Width(800).StyleSpec("margin: 30px;"),
        Html.X().TextFieldFor(m => m.Title).Width(800).LabelWidth(130).StyleSpec("Margin: 15px 0px 0px 100px"),
        Html.X().TextFieldFor(m=>m.Content).Width(800).LabelWidth(130).StyleSpec("Margin: 15px 0px 0px 100px"),
        Html.X().DateFieldFor(m => m.CreateDate).Width(800).LabelWidth(130).StyleSpec("Margin: 15px 0px 0px 100px"),
        Html.X().TextFieldFor(m => m.AuthorName).Width(800).LabelWidth(130).StyleSpec("Margin: 15px 0px 0px 100px"),
        Html.X().TextFieldFor(m => m.Email).Width(800).LabelWidth(130).StyleSpec("Margin: 15px 0px 0px 100px"),
        Html.X().CheckboxFor(m=>m.Active).LabelWidth(130).StyleSpec("Margin: 15px 0px 30px 100px").Flex(1)
)
@*<div style="display: block; float: right; margin: 50px;">
    @Html.X().LinkButton().Text("Answer this question").Width(100).Listeners(ls => ls.Click.Handler = "showWindow('Edit Answer', '/Answer/EditAnswer/'" + Model.AskId + ", true, 1, 1);")
</div>*@